<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 
<%-- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> --%>
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Sign in</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/lib/font-awesome/css/font-awesome.css">

    <script src="${pageContext.request.contextPath}/static/lib/jquery-1.11.1.min.js" type="text/javascript"></script>

    

    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/stylesheets/theme.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/stylesheets/premium.css">
	<script src="${pageContext.request.contextPath}/static/js/jquery.validate.min.js" type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/static/js/messages_zh.min.js" type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/static/js/jquery.tips.js"></script>
<script type="text/javascript">
	/* function check(){
		if($("#form1").valid()){
			var number = $("#examNumber").val();
			var password = $("#examPassword").val();
			$.ajax({
				url:"${pageContext.request.contextPath }/view/login",
				type:post,
				dataType:"json",
				async:true,
				data:{
					examNumber:number,
					examPassword:password,
				},
				success:function(data){
					if(data.result == "success"){
						$("#examNumber").tips({
							side:1,
							msg:"号码合法",
							bg:"#cccccc",
							time:4	
						}),
						$("#examPassword").tips({
							side:1,
							msg:"密码合法",
							bg:"#cccccc",
							time:4	
						})
					}else if("errorCode" == data.result){
						$("#from1").tips({
							side:1,
							msg:"号码或密码不合法",
							bg:"#cccccc",
							time:4	
						})
					}
				},
				
				error:function(data){
					alert("号码或密码不合法");
				}
				
			})
		}
	};
	 */
	$(function(){
		 $("#form1").validate({
			 errorPlacement: function (error, element) {
                if (element.parent().hasClass("input")) {
                        element.parent().after(error);
                  }else{
                        element.after(error)
                  }
                },
                 errorPlacement: function (error, element) {
                    error.appendTo(element.parent()); //直接把错误信息加在验证元素后··
                },
			 rules:{
				"examNumber":{
					required:true,
					digits:true,
					rangelength:[1,12]
				},
				"examPassword":{
					required:true,
					rangelength:[1,6]
				}
			 },
			 messages:{
				 "examNumber":"请输入你的号码(数字格式)",
				 "examPassword":"请输入你的密码",
			 }
			 
		 })
	});
	
</script>
<script>
	$(function(){
		if("${msg}" !=""){
			alert("${msg}");
		}
	})
</script>
<style type="text/css">
        #line-chart {
            height:300px;
            width:800px;
            margin: 0px auto;
            margin-top: 1em;
        }
        .navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { 
            color: #fff;
        }
    </style>
</head>
<body class=" theme-blue">

    <!-- Demo page code -->

    <script type="text/javascript">
        $(function() {
            var match = document.cookie.match(new RegExp('color=([^;]+)'));
            if(match) var color = match[1];
            if(color) {
                $('body').removeClass(function (index, css) {
                    return (css.match (/\btheme-\S+/g) || []).join(' ')
                })
                $('body').addClass('theme-' + color);
            }

            $('[data-popover="true"]').popover({html: true});
            
        });
    </script>
    <script type="text/javascript">
        $(function() {
            var uls = $('.sidebar-nav > ul > *').clone();
            uls.addClass('visible-xs');
            $('#main-menu').append(uls.clone());
        });
    </script>

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="../assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
	
    <div class="navbar navbar-default" role="navigation">
        <div class="navbar-header">
          <a class="" href="${pageContext.request.contextPath}/exam/login"><span class="navbar-brand"><span class="fa fa-paper-plane"></span>在线考试系统</span></a></div>

        <div class="navbar-collapse collapse" style="height: 1px;">

        </div>
      </div>
    </div>

        <div class="dialog">
    <div class="panel panel-default">
        <p class="panel-heading no-collapse">登录</p>
        <div class="panel-body">
            <form:form action="${pageContext.request.contextPath}/exam/login" id="form1" 
            	modelAttribute="examUser" method="post" >
               <%--  <c:if test="${msg !empty }"> --%>
	                <div class="form-group">
	                    <label>学号/工号</label>
	                    <form:input path="examNumber" type="text" class="form-control span12"/>
	                </div>
	               		 <label>密码</label>
	                <div class="form-group" id="pass">
	                   	<form:input path="examPassword" id="pwd" type="password" class="form-controlspan12 form-control"/>
		                <div style="margin-top:0" align="right">
		                    	<input type="checkbox" class="glyphicon glyphicon-eye-open" onclick="showPassword()">
		                </div>
	                </div>
	                <input type="submit" class="btn btn-primary pull-right" value="登录"/>
	                <label class="remember-me"><input type="checkbox"> 记住我</label>
	                <div class="clearfix"></div>
                <%-- </c:if> --%>
            </form:form>
        </div>
    </div>
    <p class="pull-right" style=""><a href="http://www.portnine.com" target="blank" style="font-size: .75em; margin-top: .25em;">由 Hubery 设计</a></p>
    <p><a href="reset-password.html">忘记密码?</a></p>
</div>



    <script src="${pageContext.request.contextPath}/static/lib/bootstrap/js/bootstrap.js"></script>
    <script type="text/javascript">
        $("[rel=tooltip]").tooltip();
        $(function() {
            $('.demo-cancel-click').click(function(){return false;});
        });
    </script>
    <script>
    function showPassword(){
    	if ($("#pwd").attr("type") == "password") {
            $("#pwd").attr("type", "text")
        }
        else {
            $("#pwd").attr("type", "password")
        }
    }
    </script>
  
</body></html>
